package com.yinxin.jvm;


/**
 * -verbose:gc //在控制台输出GC情况
 * -XX:+PrintGCDetails  //在控制台输出详细的GC情况
 * -Xloggc: filepath  //将GC日志输出到指定文件中
 */

/**
 * @author yinxin
 * @version 1.0
 * @Description: 对象存活算法引用计数
 * @date 2023/3/1418:09
 */
public class ReferenceCountingGc {

   public Object instance = null;

   private static final int num = 1024*1024;
   private byte[] bigSize =new byte[2*num];

   public static void main(String[] args) {
      ReferenceCountingGc objA = new ReferenceCountingGc();
      ReferenceCountingGc objB = new ReferenceCountingGc();
      objA.instance=objB;
      objB.instance=objA;
      objA=null;
      objB=null;
      System.gc();
   }
}
